<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body {
            height: 5000px;
            background-color: pink;
        }
    </style>
</head>

<body>
    <button id="btn">获取滚动条的位置</button>
    <script>
        var btn = document.querySelector('#btn')
        btn.onclick = function () {
            // 获取网页滚动条的位置信息( 滚动条卷去的页面宽度和高度 )
            console.log(window.scrollX, window.scrollY)
        }
    </script>
</body>

</html>